#include "gamesettings.h"
#include <QString>
#include <QCoreApplication>

GameSettings* GameSettings::p_instance = 0;
GameSettings::GameSettings()
{
    QString path = QCoreApplication::instance()->applicationDirPath()+"\\settings.ini";
    settings = new QSettings(path,QSettings::IniFormat);
}

void GameSettings::setUserSource(int src)
{
    settings->setValue("UserInfoSource",src);
}


Source GameSettings::cardSource()
{
    if(settings->contains("CardSource"))
        return (Source)settings->value("CardSource").toInt();
    else
        return testSource;
}

Source GameSettings::userInfoSource()
{
    if(settings->contains("UserInfoSource"))
        return (Source)settings->value("UserInfoSource").toInt();
    else
       return testSource;
}

void GameSettings::setCardSource(int src)
{
    settings->setValue("CardSource",src);
}
